package 蓝桥杯十二;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class I {
//		static int arr [] = new int[100001];
	public static void main(String []args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
//		int arr [] = new int[n + 1];
		Integer arr[] = new Integer [n + 1];
		for(int i = 1;i <= n ;i++) {
			arr[i] = i;
		}
		while(m > 0) {
			int flag = sc.nextInt();
			int pi = sc.nextInt();
			if(flag == 0) {
				Arrays.sort(arr,1,pi + 1,new Comparator<Integer>() {
					@Override
					public int compare(Integer o1,Integer o2) {
						return o2 - o1;
					}
				});
			}
			else {
				Arrays.sort(arr,pi,n + 1,new Comparator<Integer>() {

					@Override
					public int compare(Integer o1, Integer o2) {
						// TODO Auto-generated method stub
						return o1 - o2;
					}
					
				});
			}
			m--;
		}
		for(int i = 1;i <= n;i++) {
			System.out.print(arr[i] + " ");
		}
		sc.close();
	}
}
